<html><head><meta charset="gb2312"/><title>2DDrawing.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - 2D Drawing example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) 2005 - Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 100, 200, 300, 200, "2D Drawing Test")

  <font color="#3A3966">; Create an offscreen image, with a green circle in it.
</font>  <font color="#3A3966">; It will be displayed later
</font>  <font color="#3A3966">;
</font>  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateImage</font>(0, 300, 200)
    <b><font color="#3A3966">If</font></b> <font color="#3A3966">StartDrawing</font>(<font color="#3A3966">ImageOutput</font>(0))
<font color="#3A3966">      Circle</font>(100,100,50,<font color="#3A3966">RGB</font>(0,0,255))  <font color="#3A3966">; a nice blue circle...
</font>
<font color="#3A3966">      Box</font>(150,20,20,20,<font color="#3A3966"> RGB</font>(0,255,0))  <font color="#3A3966">; and a green box
</font>      
<font color="#3A3966">      FrontColor</font>(<font color="#3A3966">RGB</font>(255,0,0)) <font color="#3A3966">; Finally, red lines..
</font>      <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 20
<font color="#3A3966">        LineXY</font>(10,10+k*8,200, 0)
      <b><font color="#3A3966">Next</font></b>
      
<font color="#3A3966">      DrawingMode</font>(<font color="#FF0000">#PB_2DDrawing_Transparent</font>)
<font color="#3A3966">      BackColor</font>(<font color="#3A3966">RGB</font>(0,155,155)) <font color="#3A3966">; Change the text back and front colour
</font><font color="#3A3966">      FrontColor</font>(<font color="#3A3966">RGB</font>(255,255,255)) 
<font color="#3A3966">      DrawText</font>(10,50,"Hello, this is a test")

<font color="#3A3966">      StopDrawing</font>()
    <b><font color="#3A3966">EndIf</font></b>
  <b><font color="#3A3966">EndIf</font></b>

  <font color="#3A3966">; Create a gadget to display our nice image
</font>  <font color="#3A3966">;  
</font><font color="#3A3966">  ImageGadget</font>(0, 0, 0, 0, 0,<font color="#3A3966"> ImageID</font>(0))
  
  <font color="#3A3966">;
</font>  <font color="#3A3966">; This is the 'event loop'. All the user actions are processed here.
</font>  <font color="#3A3966">; It's very easy to understand: when an action occurs, the EventID
</font>  <font color="#3A3966">; isn't 0 and we just have to see what have happened...
</font>  <font color="#3A3966">;
</font>  
  <b><font color="#3A3966">Repeat</font></b>
    EventID =<font color="#3A3966"> WaitWindowEvent</font>() 
  <b><font color="#3A3966">Until</font></b> EventID = <font color="#FF0000">#PB_Event_CloseWindow</font>  <font color="#3A3966">; If the user has pressed on the window close button
</font>  
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">End</font></b>   <font color="#3A3966">; All the opened windows are closed automatically by PureBasic</font></font></pre>
</body></html>
